//
//  OrderCancelViewController.m
//  SXH
//
//  Created by Ryan on 16/8/15.
//  Copyright © 2016年 lyss. All rights reserved.
//

#import "OrderCancelViewController.h"
#import "CommonService.h"
@interface OrderCancelViewController ()
@property (weak, nonatomic) IBOutlet UITextView *contentTextView;

@end

@implementation OrderCancelViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"退单";
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)submitClick:(id)sender {
    if (self.contentTextView.text.length <= 0) {
        ALERT_ERR_MSG(@"理由不能为空");
        return;
    }
    CommonService *service = [[CommonService alloc]init];
    NSDictionary * parm = @{@"order_id":self.order_id,
                            @"content":self.contentTextView.text};
    [service getNetWorkData:parm Path:CANCELORDER Successed:^(id entity) {
        NSNumber *code = [entity objectForKey:@"code"];
        if ([code intValue] == 0) {
            OrderHasPaidViewController *mvc = self.pre_vc;
            [mvc getOrderData:1 RefreshView:nil];
            [self.navigationController popViewControllerAnimated:YES];
        }

    } Failed:^(NSInteger errorCode, NSString *message) {
        [self showTips:message];
    }];
    
}

- (IBAction)doback:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
